public class Solution {
    public static int[] func(int[] array,int target) {
        int[] results = new int[2];
        
        int left = 0;
        int right = array.length - 1;

        while(left < right) {

            if(array[left] + array[right] != target){
                left++;
            }

            if(array[left] + array[right] != target) {
                right--;
            }

            if(array[left] + array[right] == target) {
                results[0] = left;
                results[1] = right;
                break;
            }
        }

        if(left >= right) {
            results[0] = -1;
            results[1] = -1;
        }
        
        return results;
    }

    public static void main(String[] args) {

    }
}
